package com.ruoyi.common.core.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.ruoyi.common.annotation.Sensitive;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.enums.SensitiveStrategy;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 用户对象 sys_user
 *
 * @author Lion Li
 */

@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("sys_user")
@ApiModel("用户信息业务对象")
public class SysUser extends BaseEntity {

    /**
     * 用户ID
     */
    @ApiModelProperty(value = "用户ID")
    @TableId(value = "user_id")
    private Long userId;

    /**
     * 部门ID
     */
    @ApiModelProperty(value = "部门ID")
    private Long deptId;

    /**
     * 用户账号
     */
    @ApiModelProperty(value = "用户账号")
    private String userName;

    /**
     * 用户昵称
     */
    @ApiModelProperty(value = "用户昵称")
    private String nickName;

    /**
     * 用户类型（sys_user系统用户） 1 用户 2 咨询师
     */
    @ApiModelProperty(value = "用户类型 1 用户 2 咨询师")
    private String userType;

    /**
     * 用户邮箱
     */
    @Sensitive(strategy = SensitiveStrategy.EMAIL)
    @ApiModelProperty(value = "用户邮箱")
    private String email;

    /**
     * 手机号码
     */
//    @Sensitive(strategy = SensitiveStrategy.PHONE)
    @ApiModelProperty(value = "手机号码")
    private String phonenumber;

    /**
     * 用户性别
     */
    @ApiModelProperty(value = "用户性别")
    private String sex;

    /**
     * 用户头像
     */
    @ApiModelProperty(value = "用户头像")
    private String avatar;

    /**
     * 密码
     */
    @ApiModelProperty(value = "密码")
    @TableField(
        insertStrategy = FieldStrategy.NOT_EMPTY,
        updateStrategy = FieldStrategy.NOT_EMPTY,
        whereStrategy = FieldStrategy.NOT_EMPTY
    )
    private String password;

    @ApiModelProperty(value = "帐号状态（0正常 1停用）")
    private String status;

    @ApiModelProperty(value = "删除标志（0代表存在 2代表删除）")
    @TableLogic
    private String delFlag;

    @ApiModelProperty(value = "最后登录IP")
    private String loginIp;

    @ApiModelProperty(value = "最后登录时间")
    private Date loginDate;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "真实姓名")
    private String realName;

    @ApiModelProperty(value = "省")
    private String province;

    @ApiModelProperty(value = "市")
    private String city;

    @ApiModelProperty(value = "区")
    private String district;

    @ApiModelProperty(value = "详细地址")
    private String placeDesc;

    @ApiModelProperty(value = "工作年限")
    private String workTime;

    @ApiModelProperty(value = "身份证正面")
    private String idCardFront;

    @ApiModelProperty(value = "身份证反面")
    private String idCardBack;

    @ApiModelProperty(value = "咨询师证书")
    private String adviserPhoto;

    @ApiModelProperty(value = "文字咨询功能开关 0 关 1 开")
    private String fontSwitch;

    @ApiModelProperty(value = "电话咨询功能开关")
    private String phoneSwitch;

    @ApiModelProperty(value = "包月咨询功能开关")
    private String monthSwitch;

    @ApiModelProperty(value = "公益咨询功能开关")
    private String welfareSwitch;

    @ApiModelProperty(value = "文字咨询价钱")
    private BigDecimal fontPrice;

    @ApiModelProperty(value = "电话咨询价钱")
    private BigDecimal phonePrice;

    @ApiModelProperty(value = "包月咨询价钱")
    private BigDecimal monthPrice;

    @ApiModelProperty(value = "在线时长")
    private BigDecimal onlineTime;

    @ApiModelProperty(value = "是否在线")
    private Boolean isOnline;

    @ApiModelProperty(value = "唯一标识")
    private String uuidKey;

    @ApiModelProperty(value = "会员id")
    private String memberId;

    @ApiModelProperty(value = "推广人id")
    private Long spreadId;

    @ApiModelProperty(value = "推广人昵称")
    @TableField(exist = false)
    private String spreadNickName;

    @ApiModelProperty(value = "排序")
    private String sort;

    @ApiModelProperty(value = "个人简介")
    private String descInfo;

    @ApiModelProperty(value = "金额")
    private BigDecimal balance;

    @ApiModelProperty(value = "提现金额")
    private BigDecimal withdrawBalance;

    @ApiModelProperty(value = "未结算余额")
    private BigDecimal unBalance;

    @ApiModelProperty(value = "部门对象")
    @TableField(exist = false)
    private SysDept dept;

    @ApiModelProperty(value = "角色对象")
    @TableField(exist = false)
    private List<SysRole> roles;

    @ApiModelProperty(value = "角色组")
    @TableField(exist = false)
    private Long[] roleIds;

    @ApiModelProperty(value = "岗位组")
    @TableField(exist = false)
    private Long[] postIds;

    @ApiModelProperty(value = "角色ID")
    @TableField(exist = false)
    private Long roleId;

    public SysUser(Long userId) {
        this.userId = userId;
    }

    @ApiModelProperty(value = "是否管理员")
    public boolean isAdmin() {
        return UserConstants.ADMIN_ID.equals(this.userId);
    }

    @TableField(exist = false)
    @ApiModelProperty(value = "咨询师级别")
    private String levelInfo;

    @TableField(exist = false)
    @ApiModelProperty(value = "援助人数")
    private Integer helpPeople;

    @TableField(exist = false)
    @ApiModelProperty(value = "公益时长")
    private Double freeTime;

    @TableField(exist = false)
    @ApiModelProperty(value = "服务状态 0 否 1 是")
    private String workType;

    @ApiModelProperty("是否公益专家 0 否 1 是")
    private String isHelp;

    @TableField(exist = false)
    @ApiModelProperty(value = "用户满意度")
    private Double agreement;

    @TableField(exist = false)
    @ApiModelProperty(value = "价格")
    private BigDecimal price;

    @TableField(exist = false)
    @ApiModelProperty(value = "会员名称")
    private String name;

    @TableField(exist = false)
    @ApiModelProperty(value = "标签")
    private List<Common> goodWays;

    @TableField(exist = false)
    @ApiModelProperty(value = "咨询类型id")
    private Long askId;

    @ApiModelProperty(value = "擅长领域id字符串")
    @TableField(exist = false)
    private String common;

    @ApiModelProperty(value = "微信openid")
    private String weixinOpenid;

    @ApiModelProperty(value = "微信区域信息")
    private String areaInfo;

    @ApiModelProperty(value = "微信头像")
    private String wxAvatar;

    @ApiModelProperty(value = "用户积分")
    private Integer integral;

    @ApiModelProperty(value = "用户经验")
    private Integer experience;

    @ApiModelProperty(value = "上线时间")
    private Date loginTime;

    @ApiModelProperty(value = "下线时间")
    private Date unloginTime;

    @ApiModelProperty(value = "咨询人数")
    @TableField(exist = false)
    private Integer askNum;

    @ApiModelProperty(value = "状态:login-登录，register-注册")
    @TableField(exist = false)
    private String loginType;

    @ApiModelProperty(value = "是否推荐咨询师")
    private String isRecommend;

    @ApiModelProperty(value = "评价分数")
    @TableField(exist = false)
    private Double score;

    @TableField(exist = false)
    @ApiModelProperty(value = "评价人数")
    private Integer peopleCount;

    @TableField(exist = false)
    @ApiModelProperty(value = "咨询师级别")
    private String levelShow;

    @ApiModelProperty(value = "分销订单数量")
    @TableField(exist = false)
    private Integer distributionOrderCount;

    @ApiModelProperty(value = "我的团队数量")
    @TableField(exist = false)
    private Integer myTeamCount;

    @ApiModelProperty(value = "提现明细数量")
    @TableField(exist = false)
    private Integer withdrawalDetailCount;

    @ApiModelProperty(value = "入驻咨询师 0 待审核 1 通过 2 未通过")
    private String isFlag;

    @ApiModelProperty(value = "年龄")
    private Integer age;

    @TableField(exist = false)
    @ApiModelProperty(value = "开始从业时间")
    private Date startWorkTime;

    @TableField(exist = false)
    @ApiModelProperty(value = "培训经历")
    private String trainingExperience;

    @TableField(exist = false)
    @ApiModelProperty(value = "教育背景")
    private String eduBack;

    @TableField(exist = false)
    @ApiModelProperty(value = "擅长疗法")
    private String goodTherapy;

    @TableField(exist = false)
    @ApiModelProperty(value = "今日直属")
    private Integer thisDay;

    @TableField(exist = false)
    @ApiModelProperty(value = "本月直属")
    private Integer thisMonth;

    @TableField(exist = false)
    @ApiModelProperty(value = "服务收入")
    private BigDecimal serviceIncome;

    @TableField(exist = false)
    @ApiModelProperty(value = "咨询人数")
    private Integer consultingCount;

    @TableField(exist = false)
    @ApiModelProperty(value = "分销收入")
    private BigDecimal distributionIncome;

    @TableField(exist = false)
    @ApiModelProperty(value = "评价列表好评数量")
    private Integer goodCount;

    @TableField(exist = false)
    @ApiModelProperty(value = "评价列表中评数量")
    private Integer mediumCount;

    @TableField(exist = false)
    @ApiModelProperty(value = "评价列表差评数量")
    private Integer badCount;

    @TableField(exist = false)
    @ApiModelProperty(value = "待服务")
    private Integer toService;

    @TableField(exist = false)
    @ApiModelProperty(value = "新消息")
    private Integer newMessage;

    @TableField(exist = false)
    @ApiModelProperty(value = "包月客户")
    private Integer monthCustomer;

    @TableField(exist = false)
    @ApiModelProperty("选项")
    private String selectType;

    @TableField(exist = false)
    @ApiModelProperty("待收货数量")
    private Integer toPayCount;

    @TableField(exist = false)
    @ApiModelProperty("待发货数量")
    private Integer unShipping;

    @TableField(exist = false)
    @ApiModelProperty("待收货数量")
    private Integer unGetting;

    @TableField(exist = false)
    @ApiModelProperty("待评价数量")
    private Integer getting;

    @TableField(exist = false)
    @ApiModelProperty("售后/已完成数量")
    private Integer finish;
}
